from PyQt5.QtCore import Qt, QModelIndex
from PyQt5.QtWidgets import QStyledItemDelegate, QComboBox


class PullDown(QStyledItemDelegate):
    def __init__(self, parent, constraints):
        super().__init__(parent)
        self.constraints = constraints


    def createEditor(self, parent, option, index):
        combo = QComboBox(parent)
        combo.insertItems(["Strength", "Dexterity", "Constitution", "Intelligence", "Wisdom", "Charisma"])
        return combo

        
    def setEditorData(self, editor, index):
        combo.setValue(index.model().data(index, Qt.EditRole))


    def setModelData(self, editor, model, index):
        model.setData(index, combo.value(), Qt.EditRole)


    def updateEditorGeometry(self, editor, option, index):
        combo.setGeometry(option.rect)
